<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<?=Q::ini('appini/base_url')?>css/main.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="<?=Q::ini('appini/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('appini/base_url')?>js/0.jq.js"></script>
<script type="text/javascript" language="javascript" src="<?=Q::ini('appini/base_url')?>js/jq.prettyphoto.js"></script>
<script>
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
});
</script>
</head>
<body>
<h1><?=$customer['name']?></h1>
<p><b>Email：</b><?=$customer['email']?></p>
<p>--------------------------------------------------</p>
<p><b>注册时间：</b><?=$customer['reg_time']?></p>
<p><b>上次登录时间：</b><?=date('Y-m-d H:i:s', $customer['last_login_time'])?></p>
<p><b>登录次数：</b><?=$customer['login_count']?></p>
<p>--------------------------------------------------</p>
<p><b>地址：</b><?=$customer['address']?></p>
<p><b>电话：</b><?=$customer['phone']?></p>
<p><b>国家：</b><?=$customer['country_cn']?></p>
<p>--------------------------------------------------</p>
<p><b>订单量：</b><?=$customer['order_count']?></p>
<p><b>订单总金额：</b>￥<?=sprintf('%.2f', $customer['order_amount'])?></p>
<p><b>订单产品数量：</b><?=$customer['product_count']?></p>
<br/><br/>
<table cellspacing="0" cellpadding="3" border="0" class="table_list">
<tr>
	<td>
		<?if ($_GET['type'] == 'sales_order'):?>订单历史(<?=$customer['order_count']?>)<?else:?><a href="<?=url('datacenter::report/customerdetail', array('id'=>$customer['id'],'type'=>'sales_order'))?>">订单历史(<?=$customer['order_count']?>)</a><?endif;?>
	</td>
	<td>
		<?if ($_GET['type'] == 'visits'):?>浏览(<?=$customer['visits']?>)<?else:?><a href="<?=url('datacenter::report/customerdetail', array('id'=>$customer['id'],'type'=>'visits'))?>">浏览(<?=$customer['visits']?>)</a><?endif;?>
	</td>
	<td>
		<?if ($_GET['type'] == 'email'):?>邮件(<?=$customer['email_count']?>)<?else:?><a href="<?=url('datacenter::report/customerdetail', array('id'=>$customer['id'],'type'=>'email'))?>">邮件(<?=$customer['email_count']?>)</a><?endif;?>
	</td>
	<td>
		<?if ($_GET['type'] == 'favorites'):?>分类喜好数据<?else:?><a href="<?=url('datacenter::report/customerdetail', array('id'=>$customer['id'],'type'=>'favorites'))?>">分类喜好数据</a><?endif;?>
	</td>
</tr>
</table>

<?if ($_GET['type'] == 'sales_order'):?>
<table width="80%" cellspacing="0" cellpadding="3" border="0" class="table_list">
<tr>
	<th>订单号</th>
	<th>站点</th>
	<th>订单总额</th>
	<th>订单产品数</th>
	<th>订单时间</th>
</tr>
<?foreach ($order as $o):?>
<tr>
	<td><?=$o['number']?></td>
	<td><?=$customer['website_name']?></td>
	<td>￥<?=sprintf('%.2f', $o['amount']*$o['currency_rate'])?></td>
	<td><?=$o['product_count']?></td>
	<td><?=date('Y-m-d H:i:s', $o['sale_time'])?></td>
</tr>
<?endforeach;?>
</table>
<?endif;?>

<?if ($_GET['type'] == 'visits'):?>
<table width="100%" cellspacing="0" cellpadding="3" border="0" class="table_list">
<tr>
	<th width="75">浏览时间</th>
	<th width="130">站点</th>
	<th>产品SKU / 名称</th>
	<th>产品网站类别</th>
</tr>
<?foreach ($visits as $v):?>
<tr>
	<td><?=date('Y-m-d H:i:s', $v['time'])?></td>
	<td><?=$v['website_name']?></td>
	<td align="left">
		<?if ($v['pic_url']):?>
			<?$pretty_photo_number = 0;?>
			<?foreach ($v['pic_url'] as $vp):?>
			<a rel="pretty_photo[<?=$v['id']?>]" href="<?=Q::ini('appini/product_img').$vp?>"><?if(!$pretty_photo_number):?><span class="img_icon"></span><?endif;?></a>
			<?$pretty_photo_number = 1;?>
			<?endforeach;?>
		<?endif;?>
		[<?=$v['model']?>] <?=$v['product_name']?>
	</td>
	<td align="left"><?=$v['categories']?></td>
</tr>
<?endforeach;?>
</table>
<?=$page?>
<?endif;?>

<?if ($_GET['type'] == 'email'):?>
<table width="80%" cellspacing="0" cellpadding="3" border="0" class="table_list">
<tr>
	<th>发送时间</th>
	<th>邮件标题</th>
	<th>邮件类型</th>
</tr>
<?foreach ($email as $e):?>
<tr>
	<td><?=date('Y-m-d H:i:s', $e['time'])?></td>
	<td><?=$e['subject']?></td>
	<td><?=Helper_BSS_Normal::getAppiniNameByValue('email_type', $e['type'])?></td>
</tr>
<?endforeach;?>
</table>
<?endif;?>

<?if ($_GET['type'] == 'favorities'):?>

<?endif;?>
</body>
</html>